package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.TextView;


import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.AddClothingItem;

import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class AddClothingAdapter extends CommonAdapter<AddClothingItem> {

private  boolean isSearchEnter;



    public AddClothingAdapter(Context context, List<AddClothingItem> datas,int layoutId) {
        super(context, datas, layoutId);

    }

    public void  setIsSearchEnter(boolean isSearchEnter ){
            this.isSearchEnter=isSearchEnter;
    }


    @Override
    public void convert(final  ViewHolder holder, AddClothingItem item) {

        TextView mTextView=holder.getView(R.id.activity_addclothing_list_item_tv);
        mTextView.setText(item.getName());
        if (!isSearchEnter){
            if (item.isCheck()){
                mTextView.setBackgroundResource(R.drawable.add_list_item_checked);
                mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
            }else{
               mTextView.setBackgroundResource(R.drawable.add_list_item);
                mTextView.setTextColor(mContext.getResources().getColor(R.color.black));
            }


        }else{
            if (item.isCheck()){
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.blue));
                mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
            }else{
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));
                mTextView.setTextColor(mContext.getResources().getColor(R.color.black));
            }

        }





    }






}
